package com.management.demo.utils;

import org.apache.commons.io.FilenameUtils;
import org.springframework.web.multipart.MultipartFile;

import java.util.UUID;

public class OrderNumberUtils {

    public static String generateOrderNumber() {
        long timestamp = System.currentTimeMillis();
        int floor = (int) Math.floor(1000 + Math.random() * 9000);
        return "ORDER" + timestamp + floor;
    }

    public static String generatePicName(MultipartFile file) {
        String extension = FilenameUtils.getExtension(file.getOriginalFilename());
        return UUID.randomUUID().toString().replace("-", "").toUpperCase() + "." + extension;
    }
}
